package ch07_GUI编程;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JLabel;

public class ColorDemo {
	public static void main(String[] args) {
		BaseFrame f = new BaseFrame("Color Demo");
		f.setLayout(new GridLayout(4,4,2,2));
		
		JLabel[] labs = new JLabel[16];
		for (int i = 0; i < labs.length; i++) {
			int rgb = 255-i*17;
			labs[i]=new JLabel();
			labs[i].setOpaque(true);
			labs[i].setBackground(new Color(rgb,rgb,rgb));
			f.add(labs[i]);
		}
		f.showMe();
	}
}
